import java.util.*;

/**
 * @author LKQ
 * @date 2022/6/5 15:07
 * @description 排序 + 贪心
 */
public class Solution {
    public static void main(String[] args) {

    }
    public int partitionArray(int[] nums, int k) {
        Arrays.sort(nums);
        int ans = 0;
        for (int i = 0, j = 0; i < nums.length; i++) {
            if (nums[i] - nums[j] > k) {
                j = i;
                ans++;
            }
        }
        return ans + 1;
    }
}
